<% if(@products.count == 0) %>
<p><b><font size = "4"> Không tìm thấy sách nào trong dữ liệu</font> </b></p>

<%else%>
<h1><font color="a3bc3fc" size = "6"> <%= t :drink11%></font></h1>
<tr>
    <th></th>
    <th></th>
    <th></th>
  </tr>
<main>
<table class = "table table-stripped">
<% @count1 = 0 %>  
<% @products.each do |product| %>
  <tr>
    <% if(@count1 < 7) %>
    <%@count1 = @count1 + 1 %>
    <% @des = product.Description %>
    <% @stdes = @des.to_s %>
    <% @print = @stdes[0..120] %>
    <% @bb = Category.find(product.category_id)%>
<!-- Chrome: kich thuoc 170: 500 ho tro nhin duoc tren chrome -->
    <td width = "210">
      <%= link_to image_tag(ProductImage.find_by_product_id(product.product_id).image, :height => '170', :width => '200', :alt =>"#{product.Name}"), product %><td>
<!-- end Chrome -->

<% if false %> <!-- Firefox: kich thuoc 190: 279 nhin duoc tren firefox-->
  <td><%= link_to image_tag(ProductImage.find_by_product_id(product.product_id).image, :height => '190', :width => '279', :alt =>"#{product.Name}"), product %><td>
<% end %>     <!-- end Firefox -->

      <%= product.Name %></font></h8></a><br/>
      <%=:Giá%>: <%= product.Price%><br/>
      <%= t :mieuta %>: <%=simple_format(@print)%>.....<br/>
      <%= link_to "#{t :chitiet }", product %><br/>
      <a href="<%=@url_phat%>/shopcarts/new" ><img src="/images/buy/buy_now.jpg" alt="Buy" width="150" height="30"/>
        
      </a><br/>
    </td>
    <th></th>


    <th></th>
    

    <% if((session[:user_id])!=nil) %>
      <% @user = User.find(session[:user_id]) %>
      <% if(@user.GroupUserId==10) %>
        <td><%= link_to "#{t :edit }", edit_product_path(product) %></td>
        <td><%= link_to "#{t :destroy }", product, confirm: "#{t :xoakhong}", method: :delete %></td>    
      <%end%>   
    <%end%>

      
    <%end%>

  </tr>
<% end %>
<%end%>
</table>
</main>

<h6><td><%= link_to "#{t :next}", products_path %></td></h6>
<br />

</h1>


